package com.wanmait.wanmarecruit.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;


import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
* Created by Mybatis Generator 2022/09/19
*/
@Data
@TableName(value = "work_experience")
public class WorkExperience implements Serializable,Comparable<WorkExperience> {
    /**
     * 工作经验id
     */
     @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 职位名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 二级分类id
     */
    @TableField(value = "position_type_second_id")
    private Integer positionTypeSecondId;
    @TableField(exist = false)
    private PositionTypeSecond positionTypeSecond;

    /**
     * 在职时间
     */
    @DateTimeFormat(pattern = "yyyy-MM")
    @TableField(value = "in_service_time")
    private Date inServiceTime;

    /**
     * 离职时间
     */
    @DateTimeFormat(pattern = "yyyy-MM")
    @TableField(value = "out_service_time")
    private Date outServiceTime;

    /**
     * 工作描述
     */
    @TableField(value = "job_description")
    private String jobDescription;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Integer userId;
    @TableField(exist = false)
    private User user;

    @TableField(value = "enable")
    private Boolean enable;

    /**
     * 公司名称
     */
    @TableField(value = "company_name")
    private String companyName;

    private static final long serialVersionUID = 1L;

    public static final String COL_NAME = "name";

    public static final String COL_POSITION_TYPE_SECOND_ID = "position_type_second_id";

    public static final String COL_IN_SERVICE_TIME = "in_service_time";

    public static final String COL_OUT_SERVICE_TIME = "out_service_time";

    public static final String COL_JOB_DESCRIPTION = "job_description";

    public static final String COL_USER_ID = "user_id";

    public static final String COL_ENABLE = "enable";

    @Override
    public int compareTo(WorkExperience o) {
        long cha = this.getOutServiceTime().getTime()-o.getOutServiceTime().getTime();
        if (cha>0)
        {
            return 1;
        }
        return -1;
    }
}